const tool = require('../tools/tool')
const notification = require('../methods/notification')

module.exports = {
    getList: {
        exp: '获取通知列表',
        method: 'get',
        auth: true,
        async func(data) {
            return await notification.getList(data.currentUserId, data.query.finalId, data.query.size)
        }
    },
    getListById: {
        exp: '根据id列表获取通知列表',
        method: 'post',
        auth: true,
        async func(data) {
            return await notification.getByIds(data.param.ids)
        }
    },
    setAllRead: {
        exp: '将全部的通知设为已读状态',
        method: 'post',
        auth: true,
        async func(data) {
            await notification.setAllRead(data.currentUserId)
        }
    },
    setRead: {
        exp: '将通知设为已读',
        method: 'post',
        auth: true,
        async func(data) {
            await notification.setRead(data.param.id)
        }
    },
    getUnreadNum: {
        exp: '获取未读消息数',
        method: 'get',
        auth: true,
        async func(data) {
            return await notification.getUnreadNum(data.currentUserId)
        }
    },
    getItem:{
        exp:'获取单个信息',
        method:'get',
        auth:true,
        async func(data){
            return await notification.getItem(data.query.id)
        }
    },
    deleteItem:{
        exp:'删除单个信息',
        method:'post',
        auth:true,
        async func(data){
            await notification.deleteItem(data.param.id)
        }
    }
}